<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <title>Title</title>
</head>
<body>
<script>
  console.log(1);

  document.onclick = function () {
    console.log('click');
  }
  console.log(2);
  setTimeout(function () {
    console.log(3);
  }, 3000)
  // => 1 2 3
</script>
</body>
</html>